package org.bdware.registry.webService.model;

import com.google.gson.Gson;

public class ResponseWrapper<T> {
    boolean success;
    T data;
    String errorCode;
    String errorMessage;
    int showType;
    String traceId;
    String host;

    public ResponseWrapper() {
    }

    public ResponseWrapper(T data){
        this.success = true;
        this.errorMessage = "";
        this.data = data;
    }

    public ResponseWrapper(boolean success, T data, String errorMessage) {
        this.success = success;
        this.data = data;
        this.errorMessage = errorMessage;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public int getShowType() {
        return showType;
    }

    public void setShowType(int showType) {
        this.showType = showType;
    }

    public String getTraceId() {
        return traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String toString(){
        return new Gson().toJson(this);
    }
}
